import React, {memo} from 'react';
import {Redirect} from "react-router";
import AdminLayout from "@/components/admin-layout";

export default memo(function VerifyLogin(props) {

  const {token = "", nickname = "User"} = JSON.parse(localStorage.getItem("admin-user")) || {};
  const userId = props.match.params.id;
  const {type} = props.route;
  const {history} = props;

  return (
    <>
      {
        token && token.length > 0 ?
          (<div>
            <AdminLayout type={type} userId={userId} nickname={nickname} history={history}/>
          </div>) : (<Redirect to="/admin/login"/>)
      }
    </>
  )
})